import { postRequest, postRequest2 } from '@/utils/api'
import { param } from '.'

// 上传添加：/gv-kube/resource/cluster/upload
// 	String clusterZhname、String clusterUrl、String clusterDescription
// 	file

const $clusterManageApi = {
  // 分页获取所有集群信息
  pageGetCluster: param => {
    return postRequest('/gv-kube/resource/cluster/page', param)
  },
  // 搜索过滤
  filterCluster: param => {
    return postRequest('/gv-kube/resource/cluster/page', param)
  },
  // 删除
  delectCluster: param => {
    return postRequest('/gv-kube/resource/cluster/delete', param)
  },
  // 上传添加
  uploadAddCluster: param => {
    // return postRequest(
    //   `/gv-kube/resource/cluster/upload?clusterZhname=${param.clusterZhname}&clusterUrl=${param.clusterUrl}&clusterDescription=${param.clusterDescription}&file=${param.file}`
    // )
    return postRequest2('/gv-kube/resource/cluster/upload', param)
  },
  // 查看细节
  getClusterDetail: param => {
    return postRequest(`/gv-kube/resource/cluster/detail?id=${param}`)
  },
  // 更新集群信息
  updateClusterInfo: param => {
    return postRequest('/gv-kube/resource/cluster/update/info', param)
  },
  // 退出登录
  logOut: param => {
    return postRequest(`/gv-kube/user/layout?token=${param}`)
  }
}

export default $clusterManageApi
